import React, { Suspense } from 'react';
import ReactDOM from 'react-dom';
import zhCN from 'antd/lib/locale/zh_CN';
import {
  StyleProvider,
  legacyLogicalPropertiesTransformer,
} from "@ant-design/cssinjs";
import { ConfigProvider } from 'antd';
import RouterContent from './routers/router';
import reportWebVitals from './reportWebVitals';
import ErrorBoundary from './components/ErrorBoundary';
import './utils/axios';
import './index.css';

ReactDOM.render(
  <React.StrictMode>
    <StyleProvider
      hashPriority="high"
      transformers={[legacyLogicalPropertiesTransformer]}
    >
      <ConfigProvider locale={zhCN}>
        <ErrorBoundary>
          <Suspense fallback={<div />}>
            <RouterContent />
          </Suspense>
        </ErrorBoundary>
      </ConfigProvider>
    </StyleProvider>
  </React.StrictMode>,
  document.getElementById("root")
);

/*
  If you want to start measuring performance in your app, pass a function
  to log results (for example: reportWebVitals(console.log))
  or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
*/
reportWebVitals();
